package cn.edu.gdgm.system.service.impl;

import cn.edu.gdgm.system.entity.Slot;
import cn.edu.gdgm.system.mapper.SlotMapper;
import cn.edu.gdgm.system.service.ISlotService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;


/**
 * <p>
 * 用户设备药仓信息 服务实现类
 * </p>
 *
 * @author generator
 * @since 2021-03-04
 */
@Service
public class SlotServiceImpl extends ServiceImpl<SlotMapper, Slot> implements ISlotService {

    @Override
    public IPage<Slot> findListByPage(Integer page, Integer pageCount){
        IPage<Slot> wherePage = new Page<>(page, pageCount);
        Slot where = new Slot();

        return   baseMapper.selectPage(wherePage, Wrappers.query(where));
    }

    @Override
    public int add(Slot slot){
        return baseMapper.insert(slot);
    }

    @Override
    public int delete(Long id){
        return baseMapper.deleteById(id);
    }

    @Override
    public int updateData(Slot slot){
        return baseMapper.updateById(slot);
    }

    @Override
    public Slot findById(Long id){
        return  baseMapper.selectById(id);
    }
}
